Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@deck.gl/core

Package Overview
Dependencies
Maintainers
9
Versions
475
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deck.gl/core

deck.gl core library

  • 6.4.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
207K
increased by1.3%
Maintainers
9
Weekly downloads
 
Created

What is @deck.gl/core?

@deck.gl/core is a framework-agnostic WebGL-powered library for visualizing large-scale data sets. It provides a set of highly performant, customizable layers and tools for building complex data visualizations.

What are @deck.gl/core's main functionalities?

Layer Management

This code demonstrates how to create a Deck instance and add a GeoJsonLayer to visualize geographical data. The layer management feature allows you to add, remove, and update layers dynamically.

const { Deck, GeoJsonLayer } = require('@deck.gl/core');

const deck = new Deck({
  initialViewState: {
    longitude: -122.45,
    latitude: 37.8,
    zoom: 12
  },
  controller: true,
  layers: [
    new GeoJsonLayer({
      id: 'geojson-layer',
      data: 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/bart-stations.json',
      filled: true,
      pointRadiusMinPixels: 5,
      getPointRadius: 100,
      getFillColor: [255, 0, 0, 200]
    })
  ]
});

Custom Layer Creation

This code shows how to create a custom layer by extending the base Layer class. Custom layers allow you to define your own rendering logic and integrate it with the Deck.gl framework.

const { Layer } = require('@deck.gl/core');

class CustomLayer extends Layer {
  initializeState() {
    const { gl } = this.context;
    // Initialize WebGL state
  }

  draw({ uniforms }) {
    const { gl } = this.context;
    // Draw using WebGL
  }
}

const customLayer = new CustomLayer({
  id: 'custom-layer',
  data: []
});

deck.setProps({
  layers: [customLayer]
});

Interactivity

This code demonstrates how to add interactivity to layers, such as hover and click events. The ScatterplotLayer is made pickable, and event handlers are provided to log information when the user interacts with the layer.

const { Deck, ScatterplotLayer } = require('@deck.gl/core');

const deck = new Deck({
  initialViewState: {
    longitude: -122.45,
    latitude: 37.8,
    zoom: 12
  },
  controller: true,
  layers: [
    new ScatterplotLayer({
      id: 'scatterplot-layer',
      data: [{ position: [-122.45, 37.8], size: 100 }],
      getPosition: d => d.position,
      getRadius: d => d.size,
      getColor: [255, 0, 0],
      pickable: true,
      onHover: info => console.log('Hovered:', info),
      onClick: info => console.log('Clicked:', info)
    })
  ]
});

Other packages similar to @deck.gl/core

Keywords

FAQs

Package last updated on 22 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc